plt图片保存大小 python 您所在的位置:网站首页 plt 调整图片大小 plt图片保存大小 python

plt图片保存大小 python

#plt图片保存大小 python| 来源: 网络整理| 查看: 265

您在初始化时设置大小:

fig2 = matplotlib.pyplot.figure(figsize=(8.0, 5.0)) # in inches!

编辑 :

如果问题出现在X轴上 – 可以将它们设置为“手动”:

fig2.add_subplot(111).set_xticks(arange(1,3,0.5)) # You can actually compute the interval You need - and substitute here

等你的情节的其他方面。 你可以configuration这一切。 这是一个例子:

from numpy import arange import matplotlib # import matplotlib as mpl import matplotlib.pyplot # import matplotlib.pyplot as plt x1 = [1,2,3] y1 = [4,5,6] x2 = [1,2,3] y2 = [5,5,5] # initialization fig2 = matplotlib.pyplot.figure(figsize=(8.0, 5.0)) # The size of the figure is specified as (width, height) in inches # lines: l1 = fig2.add_subplot(111).plot(x1,y1, label=r"Text $formula$", "r-", lw=2) l2 = fig2.add_subplot(111).plot(x2,y2, label=r"$legend2$" ,"g--", lw=3) fig2.add_subplot(111).legend((l1,l2), loc=0) # axes: fig2.add_subplot(111).grid(True) fig2.add_subplot(111).set_xticks(arange(1,3,0.5)) fig2.add_subplot(111).axis(xmin=3, xmax=6) # there're also ymin, ymax fig2.add_subplot(111).axis([0,4,3,6]) # all! fig2.add_subplot(111).set_xlim([0,4]) fig2.add_subplot(111).set_ylim([3,6]) # labels: fig2.add_subplot(111).set_xlabel(r"x $2^2$", fontsize=15, color = "r") fig2.add_subplot(111).set_ylabel(r"y $2^2$") fig2.add_subplot(111).set_title(r"title $6^4$") fig2.add_subplot(111).text(2, 5.5, r"an equation: $E=mc^2$", fontsize=15, color = "y") fig2.add_subplot(111).text(3, 2, unicode('f\374r', 'latin-1')) # saving: fig2.savefig("fig2.png")

那么 – 你想要configuration什么?



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有